#include "SceneManager.h"
#include "GameScene.h"
#include "LoadScene.h"
#include "MenuScene.h"

CSceneManager* CSceneManager::mInstance = 0;
CSceneManager::~CSceneManager()
{
	delete mLoadScene;
	delete mMenuScene;
	delete mGameScene;
}
void CSceneManager::Init()
{
	InitUtil();
	mLoadScene = new CLoadScene();
	mMenuScene = new CMenuScene();
	mGameScene = new CGameScene();
}
void CSceneManager::SwitchScene(SceneType type)
{
	CCDirector::sharedDirector()->replaceScene(GetScene(type));
	mCurrentType = type;
}
CCScene* CSceneManager::GetScene(SceneType type)
{
	switch(type)
	{
	case LoadScene:
		return mLoadScene;
	case MenuScene:
		return mMenuScene;
	case GameScene:
		return mGameScene;
		break;
	}
	return NULL;
}
CCLayer* CSceneManager::GetLayer(SceneType type)
{
	switch(type)
	{
	case LoadScene:
		return mLoadScene->GetLayer();
		break;
	case MenuScene:
		return mMenuScene->GetLayer();
		break;
	case GameScene:
		return mGameScene->GetLayer();
		break;
	}
	return NULL;
}
CCScene* CSceneManager::GetCurrentScene()
{
	return GetScene(mCurrentType);
}
